package com.geek.java.ch02;

public class WhileTest {
    public static void main(String[] args) {

        int wellDepth = 7;

        int dayJump = 3;

        int nightFall = 2;

        int currentPosition = 0;

        int days = 0;

        while (currentPosition < wellDepth) {

            days++;

            currentPosition += dayJump;

            if (currentPosition >= wellDepth) {
                break;
            }
            currentPosition -= nightFall;
        }
        System.out.println("青蛙" + days + "天能爬出这口井");
    }
}
